<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>07-键盘事件</title>
    <script>
        window.onload=function () {
            let bodyEle = document.body;
            // 键盘按下
            bodyEle.onkeydown=function () {
                bodyEle.style.backgroundColor="red";
            }
            // 键盘松开
            bodyEle.onkeyup=function () {
                bodyEle.style.backgroundColor="#fff";
            }
        }
    </script>
</head>
<body>

</body>
</html>